package br.infotec.musicaunb.domain;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.search.annotations.DocumentId;
import org.springframework.data.jpa.domain.AbstractPersistable;
/**
 * entidade representando uma sala
 * @author eduardo
 *
 */
@Entity
@Table(name="sala")
public class Sala extends AbstractPersistable<Integer> implements AbstraticPojo{

	/**
	 * 
	 */
	private static final long serialVersionUID = 5252931650703675477L;
	
	private Bloco bloco;
	private String nome;
	private List<Turma> turmas;
		
	@Override
	@DocumentId
	@GeneratedValue
	@Column(name="id_sala")
	public Integer getId() {
		return super.getId();
	}
	
	@Column
	public void setNome(String nome) {
		this.nome = nome;
	}
	public String getNome() {
		return nome;
	}
	
	@ManyToOne
	@JoinColumn(name = "bloco")
	public void setBloco(Bloco bloco) {
		this.bloco = bloco;
	}
	public Bloco getBloco() {
		return bloco;
	}
	
	@OneToMany(mappedBy = "sala")
	public List<Turma> getTurmas() {
		return turmas;
	}

	public void setTurmas(List<Turma> turmas) {
		this.turmas = turmas;
	}
	
	
}
